package com.sdhs.projectschedule.controller;

import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.core.page.TableDataInfo;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.projectschedule.domain.GcProgressSupplyFill;
import com.sdhs.projectschedule.service.IGcProgressSupplyFillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 项目进度控制--供货填报Controller
 *
 * @author ww
 */
@RestController
@RequestMapping("/progress/supplyFill")
public class GcProgressSupplyFillController extends BaseController {
    @Autowired
    private IGcProgressSupplyFillService gcProgressSupplyFillService;

    /**
     * 查询项目进度控制--供货填报列表
     */
    @PreAuthorize("@ss.hasPermi('progress:supplyFill:list')")
    @GetMapping("/list")
    public TableDataInfo list(GcProgressSupplyFill gcProgressSupplyFill) {
        startPage();
        List<GcProgressSupplyFill> list = gcProgressSupplyFillService.selectGcProgressSupplyFillList(gcProgressSupplyFill);
        return getDataTable(list);
    }

    /**
     * 获取项目进度控制--供货填报详细信息
     */
    @PreAuthorize("@ss.hasPermi('progress:supplyFill:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(gcProgressSupplyFillService.selectGcProgressSupplyFillById(id));
    }

    /**
     * 新增项目进度控制--供货填报
     */
    @PreAuthorize("@ss.hasPermi('progress:supplyFill:add')")
    @Log(title = "项目进度控制--供货填报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GcProgressSupplyFill gcProgressSupplyFill) {
        return toAjax(gcProgressSupplyFillService.insertGcProgressSupplyFill(gcProgressSupplyFill));
    }

    /**
     * 修改项目进度控制--供货填报
     */
    @PreAuthorize("@ss.hasPermi('progress:supplyFill:edit')")
    @Log(title = "项目进度控制--供货填报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GcProgressSupplyFill gcProgressSupplyFill) {
        return toAjax(gcProgressSupplyFillService.updateGcProgressSupplyFill(gcProgressSupplyFill));
    }

    /**
     * 删除项目进度控制--供货填报
     */
    @PreAuthorize("@ss.hasPermi('progress:supplyFill:remove')")
    @Log(title = "项目进度控制--供货填报", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(gcProgressSupplyFillService.deleteGcProgressSupplyFillByIds(ids));
    }
}
